<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="address=no">
    <meta charset="UTF-8">
    <title>我的事件</title>
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
    <script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
    <script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/swiper.min.js"></script>
    <script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/city-picker.min.js"></script>

    <script src="/js/list.js"></script>
</head>
<body>

<div align="center" style="width: 100%;margin-top: 10px">
    <a href="/ftl/add">
    <img style="border-radius:50%;margin:10px auto"
         src="${headImage!""}"
         width="100px" height="100px">
    </a>
</div>
<div class="weui-panel__hd">我的事件</div>

<div id="content" class="weui-panel__bd" style="overflow-y:scroll;">
<#--<#if pageResult!=null>-->
    <#list (pageResult.getContent())!"" as myEvent>
        <a href="#" onclick="clickEvent('${myEvent.id!""}');" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__bd">
                <h4 class="weui-media-box__title">${myEvent.time!""}</h4>
                <p class="weui-media-box__desc">${myEvent.content!""}</p>
            </div>
        </a>
    </#list>
<#--<#else >-->
<#--
</#if>-->
</div>
<div id="foot">
<#if pageResult.getPageNo() gt 1>
<div class="weui-loadmore weui-loadmore_line" onclick="loadMore();">
    <font>点击加载更多</font>
</div>
<#else>
<div class="weui-loadmore weui-loadmore_line">
    <span class="weui-loadmore__tips">没有更多了</span>
</div>
</#if>
</div>
</body>
<script>
    $.notification({
        title: "通知",
        text: "点击头像即可添加提醒事件",
        media: "<img src='${headImage!""}'>",
    });
    var total="${pageResult.getPageNo()!""}";

    var page=1;
    function loadMore(){
        page+=1;
        $.ajax({
            url : "/event/findAllJSON",
            // 数据发送方式
            type : "GET",
            // 接受数据格式
            dataType : "json",
            // 要传递的数据
            data : "page="+page,
            success : function(result) {
                var json=result;
                if(json.code==1){
                    $.notification({
                        title: "通知",
                        text: "查询失败！",
                        media: "<img src='${headImage!""}'>",
                    });
                    $("#foot").html('<div class="weui-loadmore weui-loadmore_line" onclick="loadMore();">' +
                            '    <font>点击加载更多</font>' +
                            '</div>');
                    page-=1;
                    return;
                }
                //page对象
                var object=json.data.content;
                $(object).each(function () {
                    $("#content").append(
                   " <a href='#' onclick=\"clickEvent('"+this.id+"');\" class=\"weui-media-box weui-media-box_appmsg\">"
                           +" <div class='weui-media-box__bd'>"
                           +" <h4 class='weui-media-box__title'>"+this.time+"</h4>"
                           +" <p class='weui-media-box__desc'>"+this.content+"</p>"
                           +"</div>"
                           +"</a>"
                    );
                })
                var current=page+"";
                if(current==total){
                    $("#foot").html('<div class="weui-loadmore weui-loadmore_line">' +
                            '    <font>没有更多了</font>' +
                            '</div>');
                }
            }
        });
    }





</script>
</html>